package com.youlu.campus.admin.card.controller;

import com.youlu.campus.admin.card.dto.VipGoodsSaveDTO;
import com.youlu.campus.admin.card.dto.VipGoodsSearchDTO;
import com.youlu.campus.admin.card.dto.VipRecordSearchDTO;
import com.youlu.campus.admin.card.service.VipGoodsService;
import com.yuelin.infrastructure.quantum.common.QResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : [dengbo]
 * @className : VipGoodsController
 * @description : [vip虚拟商品类]
 * @createTime : [2022/12/28 16:38]
 */
@Slf4j
@RestController
@RequestMapping("/ts-vip/")
public class VipGoodsController {
    @Autowired
    private VipGoodsService vipGoodsService;

    /**
     * vip 虚拟商品保存
     * @param dto
     * @return
     */
    @PostMapping("/goods/save")
    public QResult save(@Validated @RequestBody VipGoodsSaveDTO dto) {
        return QResult.success(vipGoodsService.save(dto));
    }

    /**
     * vip 虚拟商品列表
     * @param searchDto
     * @return
     */
    @PostMapping("/goods/list")
    public QResult list(@RequestBody VipGoodsSearchDTO searchDto) {
        return QResult.success(vipGoodsService.list(searchDto));
    }

    /**
     * vip 虚拟商品所有列表
     * @return
     */
    @PostMapping("/goods/all")
    public QResult all() {
        return QResult.success(vipGoodsService.all());
    }

    /**
     * vip虚拟商品兑换记录列表
     * @return
     */
    @PostMapping("/record/list")
    public QResult recordList(@RequestBody VipRecordSearchDTO searchDTO) {
        return QResult.success(vipGoodsService.recordList(searchDTO));
    }
}
